# -*- coding: utf-8 -*-
# @Author : Yuan
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet
from apps.goods.models import GoodsChannel, GoodsChannelGroup, GoodsCategory
from apps.meiduo_admin.serializers.channels import GoodsChannelModelSerializer, GoodsCategoryModelSerializer, \
    GoodsChannelGroupModelSerializer
from apps.meiduo_admin.utils import PageNum


class GoodsChannelModelViewSet(ModelViewSet):
    queryset = GoodsChannel.objects.all()
    serializer_class = GoodsChannelModelSerializer
    pagination_class = PageNum


class GoodsChannelGroupListAPIView(ListAPIView):
    queryset = GoodsChannelGroup.objects
    serializer_class = GoodsChannelGroupModelSerializer


class GoodsCategoryListAPIView(ListAPIView):
    queryset = GoodsCategory.objects.filter(parent=None)
    serializer_class = GoodsCategoryModelSerializer





